Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ui5-user-menu): introduce new component #10244

Merged
merged 34 commits into from
Nov 29, 2024
Merged

Conversation

dobromiraboycheva
Copy link
Member

@dobromiraboycheva dobromiraboycheva commented Nov 25, 2024

The change introduces several components - UserMenu, UserMenuAccount, and UserMenuItem to build application forms more easily and according to the latest design guidelines.

Overview

The UserMenu is a layout component that offers a range of options specific to the user and can contain product-specific functionality.

Structure

  • UserMenu (ui5-user-menu) is the top-level container component, responsible for the content layout and responsiveness.
  • UserMenuAccount (ui5-user-menu-account) represents an account as it can be a currently selected account or one of the other accounts. It contains user's names and can have additional information and an avatar.
  • UserMenuItem (ui5-user-menu-item) represents the options in the menu that can have additional submenus.

The basic menu contains the user account of the header area on the top and content below the number of UserMenuItems. And the Sign Out button.
image

The are also options to a add Manage Account button.
image

Or to show Other accounts if they are available and ba utton for adding additional accounts.
image
image

Responsiveness

The UserMenu component reacts and changes its layout on predefined breakpoints.

  • S (<600px)
    Width-Full width
    Height-Full height
  • XLL, XL, L, M (≥ 600)
    Width, fixed-320px (20rem)
    Height, min-Hug contents
    Height, max-Screen height-52px(3.25rem) top 16px (1rem) bottom

API

UserMenu

props

  • open: boolean //false
  • opener: HTMLElement | string //undefined
  • showManageAccount: boolean //false
  • showOtherAccounts: boolean //false
  • showAddAccount: boolean //false

slot

  • menuItems!: Array;
  • accounts!: Array;
<ui5-user-menu id="userMenuShellBar" show-manage-account show-other-accounts show-add-account>
	<ui5-user-menu-account slot="accounts"
						   avatar-src ="./img/man_avatar_1.png"
						   title-text="Alain Chevalier 1"
						   subtitle-text="[email protected]"
						   description="Delivery Manager, SAP SE"
						   selected>
	</ui5-user-menu-account>
	<ui5-user-menu-account slot="accounts"
						   avatar-initials ="AC"
						   title-text="Alain Chevalier 2"
						   subtitle-text="[email protected]">
	</ui5-user-menu-account>
	<ui5-user-menu-item icon="action-settings" text="Setting" data-id="setting"></ui5-user-menu-item>
	<ui5-user-menu-item icon="globe" text="Product-specific account action" data-id="account-action1"></ui5-user-menu-item>
	<ui5-user-menu-item icon="collaborate" text="Product-specific account action" data-id="account-action2"></ui5-user-menu-item>
	<ui5-user-menu-item icon="official-service" text="Legal Information">
		<ui5-user-menu-item icon="private" text="Private Policy" data-id="privacy-policy"></ui5-user-menu-item>
	</ui5-user-menu-item>
</ui5-user-menu>

UserMenuAccount

props

  • avatarSrc?: string //""
  • avatarInitials?: string //undefined
  • titleText: string //""
  • subtitleText: string //""
  • description: string //""
  • selected: boolean //false

UserMenuItem

Extend MenuItem api.

Test Pages

fiori/test/pages/UserMenu.html

packages/fiori/src/UserMenu.ts Outdated Show resolved Hide resolved
packages/fiori/src/UserMenu.ts Outdated Show resolved Hide resolved
packages/fiori/src/UserMenu.ts Outdated Show resolved Hide resolved
packages/fiori/src/UserMenu.ts Outdated Show resolved Hide resolved
packages/fiori/src/UserMenu.ts Outdated Show resolved Hide resolved
packages/fiori/src/UserMenuAccount.ts Outdated Show resolved Hide resolved
packages/fiori/src/UserMenuAccount.ts Outdated Show resolved Hide resolved
packages/fiori/src/UserMenuAccount.ts Outdated Show resolved Hide resolved
packages/fiori/src/i18n/messagebundle.properties Outdated Show resolved Hide resolved
packages/fiori/src/i18n/messagebundle.properties Outdated Show resolved Hide resolved
@adrian-bobev adrian-bobev changed the title Ui5 profile menu feat(ui5-user-menu): introduce new component Nov 25, 2024
packages/fiori/src/UserMenu.ts Outdated Show resolved Hide resolved
packages/fiori/src/UserMenu.ts Outdated Show resolved Hide resolved
});

if (!eventPrevented) {
item.fireEvent("close-menu");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Custom events have description about their bubble, cancelable configurations. This means that we need to fire events via fireDecoratorEvent in order to apply these configurations

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason, it is not working. I guess because the MenuItem (which we extend) is still using the fireEvent. We can sync for that

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most probably this will be resolved when the following PR is merged https://github.com/SAP/ui5-webcomponents/pull/10247/files

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, Adi, you are right - @tsanislavgatev

packages/fiori/src/UserMenuAccount.ts Outdated Show resolved Hide resolved
packages/fiori/src/UserMenuAccount.ts Outdated Show resolved Hide resolved
packages/fiori/src/UserMenuAccount.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@nnaydenow nnaydenow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor. Otherwise it LGTM

packages/fiori/src/UserMenuItem.ts Outdated Show resolved Hide resolved
packages/fiori/src/UserMenuItem.ts Outdated Show resolved Hide resolved
@dobromiraboycheva dobromiraboycheva merged commit 1558499 into main Nov 29, 2024
10 checks passed
@dobromiraboycheva dobromiraboycheva deleted the ui5-profile-menu branch November 29, 2024 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants